package com.ting.etp.spring.plugin;

// local-storage-plugin模块
public class LocalStoragePlugin implements StoragePlugin {
    
    private final String rootPath;
    
    public LocalStoragePlugin(String rootPath) {
        this.rootPath = rootPath;
    }
    
    @Override
    public String getType() {
        return "local";
    }
    
    @Override
    public boolean support(String storageType) {
        return "local".equals(storageType);
    }
    
    @Override
    public String store(byte[] data, String path) {
        // 本地存储实现
        String fullPath = rootPath + "/" + path;
        System.out.println("Storing data to: " + fullPath);
        // 实际存储逻辑
        return fullPath;
    }
    
    @Override
    public byte[] retrieve(String path) {
        // 本地读取实现
        System.out.println("Retrieving data from: " + path);
        // 实际读取逻辑
        return "Local file content".getBytes();
    }
}